﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Delay
{
    public class TypePrice : DependencyObject, INotifyPropertyChanged
    {
        public TypePrice()
        {
            _typePriceItems = new ObservableCollection<PhoneInfoCenterItem>();
        }
        private ObservableCollection<PhoneInfoCenterItem> _typePriceItems;
        public ObservableCollection<PhoneInfoCenterItem> TypePriceItems
        {
            get
            {
                return _typePriceItems;
            }
            set
            {
                if (_typePriceItems != value)
                {
                    _typePriceItems = value;
                    NotifyPropertyChanged("TypePriceItems");
                }
            }
        }
        //
        private int _result;
        public int Result
        {
            get
            {
                return _result;
            }
            set
            {
                if (_result != value)
                {
                    _result = value;
                    NotifyPropertyChanged("Result");
                }
            }
        }
        public bool AllowAdd
        {
            get;
            set;
        }
        public int CurrentPage
        {
            get;
            set;
        }
        public int TotalPage
        {
            get;
            set;
        }
        public int PageSize
        {
            get;
            set;
        }
        public string GetPhoneInfoUrl(string pid,int p)
        {
            string url = QueryXml.PhoneTypePriceUrl;
            url += ("imei=" + QueryXml.imei);
            url += ("&phonename=" + QueryXml.phonename);
            url += ("&phonevs=" + QueryXml.phonevs);
            url += ("&phonevsno=" + QueryXml.phonevsno);
            url += ("&keyvalue=" + QueryXml.keyvalue);
            url += ("&channelkey=" + QueryXml.channelkey);
            url += ("&p=" +p.ToString());
            url += ("&pagesize=" + PageSize.ToString());
            url += ("&total=" + TotalPage.ToString());
            url += ("&pid=" + pid);
            return url;
        }
        //
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

    }
}
